/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ria.util;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

import ria.*;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see ria.RiaPackage
 * @generated
 */
public class RiaSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static RiaPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RiaSwitch() {
		if (modelPackage == null) {
			modelPackage = RiaPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case RiaPackage.WIDGET: {
				Widget widget = (Widget)theEObject;
				T result = caseWidget(widget);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.UI_MODEL: {
				UIModel uiModel = (UIModel)theEObject;
				T result = caseUIModel(uiModel);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.WLAYOUT: {
				WLayout wLayout = (WLayout)theEObject;
				T result = caseWLayout(wLayout);
				if (result == null) result = caseWidget(wLayout);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.EVENT: {
				Event event = (Event)theEObject;
				T result = caseEvent(event);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.WCONTROL: {
				WControl wControl = (WControl)theEObject;
				T result = caseWControl(wControl);
				if (result == null) result = caseWidget(wControl);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.WDATA_VIEW: {
				WDataView wDataView = (WDataView)theEObject;
				T result = caseWDataView(wDataView);
				if (result == null) result = caseWControl(wDataView);
				if (result == null) result = caseWidget(wDataView);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.WNAVIGATION: {
				WNavigation wNavigation = (WNavigation)theEObject;
				T result = caseWNavigation(wNavigation);
				if (result == null) result = caseWControl(wNavigation);
				if (result == null) result = caseWidget(wNavigation);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.WSERVICE: {
				WService wService = (WService)theEObject;
				T result = caseWService(wService);
				if (result == null) result = caseWControl(wService);
				if (result == null) result = caseWidget(wService);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.WINPUT: {
				WInput wInput = (WInput)theEObject;
				T result = caseWInput(wInput);
				if (result == null) result = caseWControl(wInput);
				if (result == null) result = caseWidget(wInput);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.ACCORDION: {
				Accordion accordion = (Accordion)theEObject;
				T result = caseAccordion(accordion);
				if (result == null) result = caseWLayout(accordion);
				if (result == null) result = caseWidget(accordion);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.THUMB_DRAG: {
				ThumbDrag thumbDrag = (ThumbDrag)theEObject;
				T result = caseThumbDrag(thumbDrag);
				if (result == null) result = caseEvent(thumbDrag);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.HSLIDER: {
				HSlider hSlider = (HSlider)theEObject;
				T result = caseHSlider(hSlider);
				if (result == null) result = caseWInput(hSlider);
				if (result == null) result = caseWControl(hSlider);
				if (result == null) result = caseWidget(hSlider);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.TILE_LIST: {
				TileList tileList = (TileList)theEObject;
				T result = caseTileList(tileList);
				if (result == null) result = caseWDataView(tileList);
				if (result == null) result = caseWControl(tileList);
				if (result == null) result = caseWidget(tileList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case RiaPackage.LINK_BUTTOM: {
				LinkButtom linkButtom = (LinkButtom)theEObject;
				T result = caseLinkButtom(linkButtom);
				if (result == null) result = caseWNavigation(linkButtom);
				if (result == null) result = caseWService(linkButtom);
				if (result == null) result = caseWControl(linkButtom);
				if (result == null) result = caseWidget(linkButtom);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Widget</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Widget</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWidget(Widget object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>UI Model</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>UI Model</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseUIModel(UIModel object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WLayout</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WLayout</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWLayout(WLayout object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Event</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Event</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEvent(Event object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WControl</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WControl</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWControl(WControl object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WData View</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WData View</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWDataView(WDataView object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WNavigation</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WNavigation</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWNavigation(WNavigation object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WService</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WService</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWService(WService object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WInput</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WInput</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWInput(WInput object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Accordion</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Accordion</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAccordion(Accordion object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Thumb Drag</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Thumb Drag</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseThumbDrag(ThumbDrag object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>HSlider</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>HSlider</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseHSlider(HSlider object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Tile List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Tile List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTileList(TileList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Link Buttom</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Link Buttom</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseLinkButtom(LinkButtom object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //RiaSwitch
